<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--
  Created by IntelliJ IDEA.
  User: 18134216985
  Date: 2024-04-25
  Time: 12:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/webjars/layui/2.6.8/css/layui.css">
    <script src="/webjars/layui/2.6.8/layui.js"></script>
</head>
<body>
<div class="layui-tab" lay-filter="test-hash">
    <ul class="layui-tab-title">
        <li class="layui-this" lay-id="11">其他费用</li>
        <li lay-id="22">停车费</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">

            <%--条件查询--%>
            <div class="layui-collapse">
                <div class="layui-colla-item">

                    <h2 class="layui-colla-title">查询条件</h2>
                    <div class="layui-colla-content layui-show">
                        <div class="layui-form"  id="paysearchForm" lay-filter="paysearchForm">
                            <div class="layui-inline">
                                <select name="itemid">
                                    <option value="0">请选择缴费类型</option>
                                </select>
                            </div>
                            <div class="layui-inline">
                                <input type="datetime-local" id="epaytime" name="epaytime" class="layui-input" placeholder="支付时间">
                            </div>
                            <input type="hidden" id="paytime" name="paytime">
                            <div class="layui-inline">
                                <button class="layui-btn" onclick="paysearch()" >查询</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-hide" id="ID-paytable-demo-data" lay-filter="payTable"></table>
            <script>
                let $=layui.$;
                let table=layui.table;
                /*渲染下拉列表*/
                $.get("/Item/selectGuDingItem").then(({data})=>{
                    $(data).each(function (i,e){
                        let option =$("<option value='"+e.id+"'>"+e.itemname+"</option>")
                        $("[name=itemid]").append(option);
                    })
                    layui.form.render('select');
                })
                layui.use("table",function (){
                    table.render({
                        id:'pay',
                        elem:'#ID-paytable-demo-data',
                        url:"/tempPay/ownerselectPayRecording?ownerid="+${sessionScope.loginUser.id},
                        page:true,
                        cols:[[
                            {field:'number',align: 'center',type:'numbers',title:"编号"},
                            {field:'id',align: 'center',hide:true,title:"序号"},
                            {align: 'center',field: 'ownerid',title: '业主',templet(d){
                                    return d.owners==null?"-":d.owners.ownername;
                                }},
                            {align: 'center',field: 'itemid',title: '缴费类型',templet(d) {
                                    return d.item==null?"-":d.item.itemname;
                                }},
                            {align: 'center',field: 'paymoney',title: '支付金额'},
                            {align: 'center',field: 'paytime',title: '支付时间'},
                            {align: 'center',field: 'paystate',title: '付款状态',templet(d) {
                                    return d.paystate==0?"未缴费":"已缴费";
                                }},
                            {align: 'center',field: 'notes',title: '备注'},
                        ]]
                    })
                })
                //点击查询
                function paysearch(){
                    var time = $("#epaytime").val();
                    var replace1 = time.replace("T"," ");
                    console.log(time)
                    $("#paytime").val(replace1);
                    var search=layui.form.val('paysearchForm');
                    layui.table.reload('pay', {
                        page: {
                            curr:1
                        },
                        where: search
                    });
                }

            </script>
        </div>
        <div class="layui-tab-item">
            <%--条件查询--%>
            <div class="layui-collapse">
                <div class="layui-colla-item">

                    <h2 class="layui-colla-title">查询条件</h2>
                    <div class="layui-colla-content layui-show">
                        <div class="layui-form"  id="carsearchForm" lay-filter="carsearchForm">
                            <div class="layui-inline">
                                <input type="datetime-local" id="eendtime" name="eendtime" class="layui-input" placeholder="离开时间">
                            </div>
                            <div class="layui-inline">
                                <input type="text" id="parklotname" name="parklotname" class="layui-input" placeholder="车位">
                            </div>
                            <div class="layui-inline">
                                <select name="parkid" id="">
                                    <option value="0">请选择停车场</option>
                                </select>
                            </div>
                            <input type="hidden" id="endtime" name="endtime">
                            <div class="layui-inline">
                                <button class="layui-btn" onclick="carsearch()" >查询</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <table class="layui-hide" id="ID-cartable-demo-data" lay-filter="payTable"></table>
            <script>
                /*渲染下拉列表*/
                $.get("/tempPay/selectAllPark").then(({data})=>{
                    $(data).each(function (i,e){
                        let option =$("<option value='"+e.id+"'>"+e.parkcode+"</option>")
                        $("[name=parkid]").append(option);
                    })
                    layui.form.render('select');
                })
                layui.use("table",function (){
                    table.render({
                        id:'car',
                        elem:'#ID-cartable-demo-data',
                        url:"/tempPay/OwnerSelectStopCar?phone="+${sessionScope.loginUser.ownerphone},
                        page:true,

                        cols:[[
                            {field:'number',align: 'center',type:'numbers',title:"编号"},
                            {field:'id',align: 'center',hide:true,title:"序号"},
                            {align: 'center',field: 'ownername',title: '业主'},
                            {align: 'center',field: 'ownerphone',title: '联系方式'},
                            {align: 'center',field: 'parklotname',title: '车位'},
                            {align: 'center',field: 'parkname',title: '停车场'},
                            {align: 'center',field: 'starttime',title: '开始时间'},
                            {align: 'center',field: 'endtime',title: '结束时间'},
                            {align: 'center',field: 'zomoney',title: '支付金额'},

                        ]]
                    })
                })
                //点击查询
                function carsearch(){
                    var time = $("#eendtime").val();
                    var replace1 = time.replace("T"," ");
                    console.log(time)
                    $("#endtime").val(replace1);
                    var search=layui.form.val('carsearchForm');
                    console.log(search)
                    layui.table.reload('car', {
                        page: {
                            curr:1
                        },
                        where: search
                    });
                }
            </script>
        </div>
    </div>
</div>


    </div>
</div>
</body>
</html>
